package thread;

/**
 *java中所有的代码都是在线程中执行的，main方法也不例外
 */
public class CurrentThreadDemo {
    public static void main(String[] args) {
        Thread main = Thread.currentThread();
        System.out.println("主线程执行"+ main);
        doSome();
    }

    //自定义一个线程
    Thread t = new Thread(){
        public void run() {
            Thread t = Thread.currentThread();
            System.out.println("自定义线程执行"+ t);
            doSome();
        }
    };

    public static void doSome(){
        Thread t = Thread.currentThread();
        System.out.println("执行doSome方法的线程是"+ t);
    }
}
